package com.bestvike.stone.spring.exception;

/**
 * Created by 许崇雷 on 2018-03-05.
 */
public class BusinessException extends RuntimeException {
    private final String code;
    private final String msg;

    public BusinessException(ErrorCode errorCode) {
        this(errorCode.getCode(), errorCode.getMsg());
    }

    public BusinessException(ErrorCode errorCode, String msg) {
        this(errorCode.getCode(), msg);
    }

    public BusinessException(String code, String msg) {
        super(code + ":" + msg);
        this.code = code;
        this.msg = msg;
    }

    public String getCode() {
        return this.code;
    }

    public String getMsg() {
        return this.msg;
    }
}
